package com.study.guide.codec.MessagePack;

import java.util.List;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class TimeServerHandler extends SimpleChannelInboundHandler<Object> {


	@Override
	public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
		  @SuppressWarnings("unchecked")
		List<UserInfo> u= (List<UserInfo>) msg;
		System.out.println("------------"+u);
		ctx.writeAndFlush(msg); //收到消息后直接返回给Client
	}

	@Override
	public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
		ctx.flush();
	}

	@Override
	public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
		ctx.close();
	}
	@Override
	public void channelActive(ChannelHandlerContext ctx) throws Exception {
		System.out.println("------------服务端激活");
	}
}
